package com.star.percalservice.controller;

import com.star.percalservice.model.dto.PatentDTO;
import com.star.percalservice.model.entity.Patent;
import com.star.percalservice.service.PatentService;
import com.star.percalservice.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author star
 * @version 1.0
 * @Description:
 * @DateTime 2025/4/12 2:37
 */

@RestController
@RequestMapping("/api/patent")
public class PatentController {

    @Autowired
    private PatentService patentService;

    @PostMapping("/list")
    public R list(@RequestBody PatentDTO dto) {
        return patentService.list(dto);
    }

    @PostMapping("/add")
    public R add(@RequestBody Patent patent) {
        return patentService.add(patent);
    }

    @PostMapping("/update")
    public R update(@RequestBody Patent patent) {
        return patentService.update(patent);
    }

    @PostMapping("/delete")
    public R delete(Integer id) {
        return patentService.delete(id);
    }

    @PostMapping("/change-status")
    public R changeStatus(Integer id, String status) {
        return patentService.changeStatus(id, status);
    }

}
